/*----------------------------------------\ | Goto the last cell of the last table; | |-------------------------------------------| |--------------------------------------------------------------------| |---------------------------| | Argument: | | bmark: the name of the table to be deleted; | | isn't necessary; default is the current table; | | wordref: you can specify window reference, default if "wordsys";| | Note: the wordref must be the 2nd paramter; | | Note: space will be read as a part of the book mark; if no bookmark| | is entered, then assume the cursor is in a table, so delete the | | current table. | |-----------------------------| |--------------------------------------------------------------------| |---------------------------------------| | Example: %lastcell('t1'); | | Usage: %lastcell(bmark,wordref); | \----------------------------------------*/ %macro lastcell/parmbuff; /*--------------------------------------------\ | Copy Right: Duo Zhou; | | Created: 6-27-2001 9:55pm; | | Purpose: Delete a table; | \--------------------------------------------*/ %local bookmark wordref; %let bookmark=%qscan(&syspbuff,1,%str(,()''"")); %let fref=;%let wsid=0; %if %words(&syspbuff, dlm=%quote(,()))>1 %then %let fref=%qscan(&syspbuff,-1,%str(,()''""= )); %else %let fref=wordsys; %if (%quote(&bookmark) ne) %then %do; %gotobmark("&bookmark"); %end; %if (&fref ne ) %then %let wsid=%sysfunc(fopen(&fref,o,132,e)); %if &wsid %then %do; %let rc=%sysfunc(fclose(&wsid)); data _null_; file &fref lrecl=2000; put '[TableSelectTable]'; put '[EndOfColumn]'; put '[EndOfColumn]'; put '[EndOfRow]'; put '[EndOfRow]'; put '[TableSelectTable]'; put '[EndOfLine]'; run; %end; %else %put ==> Alert! Incorrect window reference "&fref", or window "&fref" isn%str(%')t open.; %mend lastcell;